<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="text" value="0">
    <input type="button" id="btn" value="点我+1">
</body>
<script>
    var text=document.querySelector('#text');
    var btn=document.querySelector('#btn');
    btn.onclick = function () {
        var num=text.value;
        num++;
        text.value=num;
    }
</script>
</html>